/*
 * Copyright 2018-present KunMinX
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.nsgf.library.ui.adapter;

import android.content.Context;
import android.graphics.Typeface;

import androidx.recyclerview.widget.RecyclerView;

import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter;
import com.nsgf.library.R;
import com.nsgf.library.data.bean.LibraryInfo;
import com.nsgf.library.databinding.FragmentNsgfHomeWorkSituationBinding;
import com.nsgf.library.databinding.ItemHomeGateBinding;

/**
 * Create by GC at 24/10/19
 */
public class HomeLabelGateTitleListAdapter extends SimpleDataBindingAdapter<LibraryInfo, FragmentNsgfHomeWorkSituationBinding> {

    public HomeLabelGateTitleListAdapter(Context context) {
        super(context, R.layout.fragment_nsgf_home_work_situation, DiffUtils.getInstance().getLibraryInfoItemCallback());

    }

    @Override
    protected void onBindItem(FragmentNsgfHomeWorkSituationBinding binding, LibraryInfo item, RecyclerView.ViewHolder holder) {
        binding.setVm(item);


        if (item.isCheck()) {
            // 选中文本样式
            binding.tvItemTitle.setTextColor(mContext.getResources().getColor(R.color.color_D2129)); // 设置选中文本颜色
            binding.tvItemTitle.setTypeface(Typeface.DEFAULT_BOLD);
        } else {
            binding.tvItemTitle.setTextColor(mContext.getResources().getColor(R.color.color_4E5969)); // 设置文本颜色
            binding.tvItemTitle.setTypeface(Typeface.DEFAULT);

        }
    }
}
